package com.feng.mainPack;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class StartSprider {
	
	public static void main(String[] args) {
		
		String startUrl = "http://www.cnblogs.com/cyq1162/";
		
		QueueList.downloadPath += ("\\"+startUrl.replace("http://www.cnblogs.com/", "").replace("/", ""));
		
		//定长线程池
//		ExecutorService pool = Executors.newFixedThreadPool(5);
//		可缓存线程池
		ExecutorService pool = Executors.newCachedThreadPool();
		
		Thread getPageUrl = new GetPageUrl(startUrl);
		
		Thread getUrls = new GetUrls(startUrl);
		
		Thread getContent = new GetContent();
		
		pool.execute(getPageUrl);
		
		try {
			Thread.sleep(5000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		
		pool.execute(getUrls);
		
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		};
		
		pool.execute(getContent);
		
		pool.shutdown();
		
	}

}
